package com.aiden.cashbook.bean;

import android.os.Parcel;
import android.os.Parcelable;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Keep;
import org.greenrobot.greendao.annotation.Unique;

@Entity
public class User implements Parcelable {

    @Id(autoincrement = true)
    private long id;

    @Unique
    private String phone;
    private String username;
    private String password;
    private String gender; // M男，F女
    private String birthday; // yyyy-MM-dd

    protected User(Parcel in) {
        id = in.readLong();
        phone = in.readString();
        username = in.readString();
        password = in.readString();
        gender = in.readString();
        birthday = in.readString();
    }

    @Keep
    @Generated(hash = 1950491907)
    public User(String phone, String username, String password, String gender,
            String birthday) {
        this.phone = phone;
        this.username = username;
        this.password = password;
        this.gender = gender;
        this.birthday = birthday;
    }

    @Generated(hash = 586692638)
    public User() {
    }

    @Generated(hash = 827894866)
    public User(long id, String phone, String username, String password,
            String gender, String birthday) {
        this.id = id;
        this.phone = phone;
        this.username = username;
        this.password = password;
        this.gender = gender;
        this.birthday = birthday;
    }

    public static final Creator<User> CREATOR = new Creator<User>() {
        @Override
        public User createFromParcel(Parcel in) {
            return new User(in);
        }

        @Override
        public User[] newArray(int size) {
            return new User[size];
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeLong(id);
        dest.writeString(phone);
        dest.writeString(username);
        dest.writeString(password);
        dest.writeString(gender);
        dest.writeString(birthday);
    }

    public long getId() {
        return this.id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getUsername() {
        return this.username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return this.password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getGender() {
        return this.gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String getBirthday() {
        return this.birthday;
    }

    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", phone='" + phone + '\'' +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", gender='" + gender + '\'' +
                ", birthday='" + birthday + '\'' +
                '}';
    }
}


